<?php
define('IN_WONDERSHARE', true);
require( '../../inc/config.inc.php');
require( '../../includes/cls_mysql.php');
$db = new cls_mysql($db_host, $db_user, $db_pass, $db_name);
if( $_POST['code'] != md5('contact') ) exit('error code!');

$uploaddir =  dirname(dirname(dirname(__FILE__))).'/image2/contact/';
$uploadfile = $uploaddir .date("YmdHis").'_'.$_FILES['f']['name'];
$picUrl = '';
if(move_uploaded_file($_FILES['f']['tmp_name'], $uploadfile))
{ 
	 $picUrl = str_replace('/var/www/website/cms.wondershare.com/httpdocs','http://cms.wondershare.com',$uploadfile); 
}
 $sql = "insert into contact(`firstName`,`lastName`,`email`,`content`,`picUrl`,`addTime`)values('".$_POST['firstName']."','".$_POST['lastName']."','".$_POST['email']."','".$_POST['content']."','".$picUrl."',now());";
if($db->query($sql))
{
	   echo 1;
}else{
	   echo 0;
}

?>